package com.tupi.project.ui.presenter;

import com.tupi.project.base.RxPresenter;
import com.tupi.project.component.RxBus;
import com.tupi.project.event.SimpleEvent;
import com.tupi.project.ui.contract.RxBusContract;

import javax.inject.Inject;

import io.reactivex.functions.Consumer;

/**
 * Created by Administrator on 2017/11/2.
 */

public class RxBusPresenter extends RxPresenter<RxBusContract.View> implements RxBusContract
        .Presenter
{
    
    @Inject
    public RxBusPresenter()
    {
        super();
    }
    
    
    @Override
    public void put()
    {
        //发布事件
        RxBus.getDefault().post(new SimpleEvent("测试"));
    }
    
    @Override
    public void add()
    {
      
        
    }
    
    @Override
    public void addEvent()
    {
        //添加事件
        addRxBusSubscribe(SimpleEvent.class, new Consumer<SimpleEvent>()
        {
            @Override
            public void accept(SimpleEvent simpleEvent) throws Exception
            {
                mView.showReceive(simpleEvent);
            }
        });
    }
}
